import Vue from 'vue'
import Router from 'vue-router'
Vue.use(Router)
const router = new Router({
  routes: [
    {
      path: '/',
      redirect: '/orderExcel'
    },
    {
      path: '/index',
      name: 'index',
      component: () => import(/* webpackChunkName: "about" */ '@/views/index.vue'),
      children: [
        {
          path: '/orderExcel',
          name: 'orderExcel',
          component: () => import(/* webpackChunkName: "about" */ '@/views/orderExcel.vue')
        }
      ]
    },
    {
      path: '*',
      redirect: '/'
    }
  ]
})
router.beforeEach((to, from, next) => {
  document.title = '订单系统'
  if (to.fullPath.indexOf('orderInfo') !== -1) {
    document.title = '新建订单'
  } else if (to.fullPath.indexOf('orderList') !== -1) {
    document.title = '订单列表'
  } else if (to.fullPath.indexOf('infoList') !== -1) {
    document.title = '信息维护'
  } else if (to.fullPath.indexOf('goodsList') !== -1) {
    document.title = '单品列表'
  }
  next()
})
export default router
